let request = require('request');
// const zlib = require('zlib');
// const FileCookieStore = require('tough-cookie-filestore');
// // NOTE - currently the 'cookies.json' file must already exist!
// const j = request.jar(new FileCookieStore('cookies.json'));
// request = request.defaults({ jar : j })
/**
 * 
GET /query?type=yuantong&postid=YT5263426769002&temp=0.5802106249904664&phone= HTTP/1.1
Host: www.kuaidi100.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
sec-ch-ua: "Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"
Accept: application/json, text/javascript,  q=0.01
X-Requested-With: XMLHttpRequest
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.kuaidi100.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,la;q=0.7
Cookie: csrftoken=G7N2y-_HFRou5DY8Q4aOSdQRsXs2sPLnew8Ot28oM_s; WWWID=WWW1469F78034728C3288993FD9305DDBA1; Hm_lvt_22ea01af58ba2be0fec7c11b25e88e6c=1614341950,1614410032; Hm_lpvt_22ea01af58ba2be0fec7c11b25e88e6c=1614410200
 */
//                                                              YT5263426769002

let url = 'https://www.kuaidi100.com/query?type=yuantong&postid=YT5263426769002&temp='+Math.random()+'&phone='

const options = {
    url: url,
    //头   头信息
    headers: {
        'Host': 'www.kuaidi100.com',
        'Connection': 'close',
        'Pragma': 'no-cache',
        'Cache-Control': 'no-cache',
        'Accept': 'application/json, text/javascript,  q=0.01',
        'X-Requested-With': 'XMLHttpRequest',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36',
        'Referer': 'https://www.kuaidi100.com/',
        'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,la;q=0.7'
    }
};

//请求的回调
function callback(error, response, body) {
    console.log(body);
}

request(options, callback);